$(document).ready(function () {
	bsdt.onload();
})

var bsdt = (function () {

	$(window).resize(function () {
		bsdt.windowResize();
	});

	var init = function () {
		/*表格偶数增加背景色*/
		$(".wxl_list_con table tr:nth-child(2n)").css("background", "#f9fafd");
		$(".wxl_bsdt_con .item_content ul li:nth-child(2n)").css("margin", "0px");
	}

	return {
		onload: function () {
			init();
			//			bsdt.collectShow();
			bsdt.tabSwitch();
			bsdt.tablePage();
			bsdt.windowResize();
		},
		/*添加收藏弹框*/

		/*办税指引、我的消息选项卡*/
		tabSwitch: function () {
			var item_content_li_w = $(".item_content li").width();
			$(".item").css("width", item_content_li_w + "px");
			$(".item_content ul li:nth-child(2n)").css("margin", "0px");
			$(".wxl_list p>span.f_left").click(function () {
				var n = $(this).index();
				$(this).addClass("active");
				$(this).siblings("span.f_left").removeClass("active");
				$(".wxl_list_con .wxl_tab_con").eq(n).show();
				$(".wxl_list_con .wxl_tab_con").eq(n).siblings(".wxl_tab_con").hide();
			});
		},
		/*表格分页*/
		tablePage: function () {
			$('#wxl_bszj').dataTable({
				"pagingType": "full_numbers",
				"info": false,
				"pageLength": 7,
				"lengthChange": false,
				"ordering": false,
				"searching": false
			});
			$('#wxl_my_msg').dataTable({
				"pagingType": "full_numbers",
				"info": false,
				"pageLength": 7,
				"lengthChange": false,
				"ordering": false,
				"searching": false
			});
			$('#wxl_my_fxNotice').dataTable({
				"pagingType": "full_numbers",
				"info": false,
				"pageLength": 7,
				"lengthChange": false,
				"ordering": false,
				"searching": false
			});

		},
		//页面缩放效果
		windowResize: function () {
			setTimeout(function () {
				var content_bsdt_h = $(window).height() - 10;
				$(".wxl_bsdt_con").css("height", content_bsdt_h + "px");
				$(".wxl_list").css("height", content_bsdt_h - 16 + "px");
			})
		},

		//关闭layui弹出框
		closeLayuiOpen: function () {
			layer.closeAll();
		}
	}
})();